package com.cxz.study.application.order.web.mapper;

import com.cxz.study.application.order.web.OrderVO;
import com.cxz.study.application.order.web.req.CancelOrderRequest;
import com.cxz.study.application.order.web.req.CreateOrderRequest;
import com.cxz.study.domain.order.Order;
import com.cxz.study.domain.order.command.CancelOrderCommand;
import com.cxz.study.domain.order.command.CreateOrderCommand;
import com.cxz.study.domain.order.orderId.OrderIdMapper;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * @className: OrderWebMapperStruct
 * @author: ocxz1
 * @date: 2025/6/15 下午12:02
 * @Version: 1.0
 * @description: ddd-struct3
 */
@Mapper(uses = {OrderIdMapper.class})
public interface OrderWebMapperStruct {
    CreateOrderCommand toCommand(CreateOrderRequest request);

    OrderVO toVO(Order order);

    CancelOrderCommand toCommand(CancelOrderRequest request);

    default CancelOrderCommand toCommandWithOrderId(CancelOrderRequest request, Long orderId) {
        CancelOrderCommand command = toCommand(request);
        command.setOrderId(orderId);
        return command;
    }
}

    
    